package com.globallogic.draw;

public class Rectangle extends DrawObject implements Drawable {
	
	public Rectangle(int width, int heght) {

		if ((width <= 0) || (heght <= 0)) {
			
			throw new IllegalArgumentException();
			
		}
		
		this.width = width;
		this.heght = heght;		
        this.drawChar = 'r';		
		
	}
	
	public float calculateSquare() {
		
		return width*heght;
		
	}
	
	public boolean isPointInside(int x, int y) {
		
		return ((x > 0) && (x < width) && (y > 0) && (y < heght));
		
	}
	
	public String toString() {
		
		return this.getClass().getSimpleName();
		
	}

	private int width;
	private int heght;
	
	@Override
	public int getLenght() {
		
		return width;
		
	}
	
}
